


export function getRedirectPath({type, avatar}){
	// 根据用户信息 返回跳转地址
	// user.type /boss /genius
	// user.avatar /bossinfo /geniusinfo 
	let url = (type==='boss')?'/boss': '/genius'
	if (!avatar) {
		url += 'info'
	}
	return url
}

export function getChatId(userId,targetId) {
	return [userId,targetId].sort().join('')
}

// 设置cookie
export function setCookie(name, value) {
	var exp = new Date();
	exp.setTime(exp.getTime() + 3 * 24 * 60 * 60 * 1000); //3天过期
	document.cookie = name + "=" + encodeURIComponent(value) + ";expires=" + exp.toGMTString() + ";path=/";
	return true;
  };
  
  //读取cookie
  export function getCookie(name) {
	var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
	if (arr = document.cookie.match(reg))
	  return unescape(arr[2]);
	else
	  return '';
  };

	export function getLast(arr){
	return arr[arr.length-1]
  }